`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    22:11:41 04/02/2013 
// Design Name: 
// Module Name:    Asynchronous_FIFO 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module Asynchronous_FIFO(
	input push,
	input pop,
	input [7:0] wdata,
	input wclk,
	input rclk,
	output reg [7:0] rdata,
	output reg full = 0,
	output reg empty =1 
    );
	
	reg [2047:0] FIFO = 0;
	reg [10:0] pushcount = 0;
	reg [10:0] popcount = 0;
	reg [10:0] d_count = 0;
	reg [10:0] temppopcount = 0;

	
	
	always @( posedge wclk, posedge rclk)
		begin
		if (pushcount == 256 && popcount == 256)
			begin
				full = 1;
			end
		else if (pushcount >= 1 && pushcount <=256 && popcount !=0)
			begin 
				empty = 0;
			end
		else if ( (popcount == 0 && pushcount==256) || (popcount == 0 && pushcount == 0) )
			begin
			empty =1;
			end
		else if (popcount != 256)
			begin 
				full = 0;
			end
			else
			begin
			end
		end	
				

	always @(negedge wclk )
	begin
		if (push == 1)
		begin
		pushcount = pushcount + 1;
		
		if (pushcount == 256)
			begin
			end
		FIFO =  (FIFO << 8 )| wdata;
		//$display ("FIFO is = %b", FIFO); 
		//$display ("pushcount = %d", pushcount);
		end
	end
	
			
		
	/*always @(posedge rclk)
	begin
		//popcount = pushcount;
		$display ("wdata is = %b", wdata);
		$display ("popcount is = %d", popcount);
	end*/ 
		
	always @(posedge rclk)
		begin
		temppopcount = pushcount;
		popcount = temppopcount - d_count;
		if (pop == 1)
		begin
		//popcount <= popcount - 1;
		//pushcount <= pushcount - 1;
		if (popcount == 1) // && pushcount != 1) 
			begin
			//empty = 1; 
			//full = 0;
			rdata = FIFO[7:0];
			//FIFO <= 0; 
			d_count = d_count +1;
			end
		else if (popcount == 2)
			begin 
			//empty = 0; 
			//full = 0;
			rdata = FIFO[15:8];
			d_count = d_count +1;
			end
		else if (popcount == 3)
			begin 
			//empty = 0; 
			//full = 0;
			rdata = FIFO[23:16];
			d_count = d_count +1;
			end
		else if (popcount == 4)
			begin 
			//empty = 0; 
			//full = 0;
			rdata = FIFO[31:24];
			d_count = d_count +1;
			end
		else if (popcount == 5)
			begin 
			//empty = 0; 
			//full = 0;
			rdata = FIFO[39:32];
			d_count = d_count +1;
			end
		else if (popcount == 6)
			begin 
			//empty = 0; 
			//full = 0;
			rdata = FIFO[47:40];
			d_count = d_count +1;
			end
		else if (popcount == 7)
			begin 
			//empty = 0;
			//full = 0;			
			rdata = FIFO[55:48];
			d_count = d_count +1;
			end
		else if (popcount == 8)
			begin 
			//empty = 0; 
			//full = 0;
			rdata = FIFO[63:56];
			d_count = d_count +1;
			end
		else if (popcount == 9)
			begin 
			//empty = 0; 
			//full = 0;
			rdata = FIFO[71:64];
			d_count = d_count +1;
			end
		else if (popcount == 10)
			begin 
			//empty = 0; 
			//full = 0;
			rdata = FIFO[79:72];
			d_count = d_count +1;
			end

		else if( popcount == 11)
		  begin
		  rdata = FIFO[87:80];
		  d_count = d_count +1;
		  end
		else if( popcount == 12)
		  begin
		  rdata = FIFO[95:88];
		  d_count = d_count +1;
		  end
		else if( popcount == 13)
		  begin
		  rdata = FIFO[103:96];
		  d_count = d_count +1;
		  end
		else if( popcount == 14)
		  begin
		  rdata = FIFO[111:104];
		  d_count = d_count +1;
		  end
		else if( popcount == 15)
		  begin
		  rdata = FIFO[119:112];
		  d_count = d_count +1;
		  end
		else if( popcount == 16)
		  begin
		  rdata = FIFO[127:120];
		  d_count = d_count +1;
		  end
		else if( popcount == 17)
		  begin
		  rdata = FIFO[135:128];
		  d_count = d_count +1;
		  end
		else if( popcount == 18)
		  begin
		  rdata = FIFO[143:136];
		  d_count = d_count +1;
		  end
		else if( popcount == 19)
		  begin
		  rdata = FIFO[151:144];
		  d_count = d_count +1;
		  end
		else if( popcount == 20)
		  begin
		  rdata = FIFO[159:152];
		  d_count = d_count +1;
		  end
		else if( popcount == 21)
		  begin
		  rdata = FIFO[167:160];
		  d_count = d_count +1;
		  end
		else if( popcount == 22)
		  begin
		  rdata = FIFO[175:168];
		  d_count = d_count +1;
		  end
		else if( popcount == 23)
		  begin
		  rdata = FIFO[183:176];
		  d_count = d_count +1;
		  end
		else if( popcount == 24)
		  begin
		  rdata = FIFO[191:184];
		  d_count = d_count +1;
		  end
		else if( popcount == 25)
		  begin
		  rdata = FIFO[199:192];
		  d_count = d_count +1;
		  end
		else if( popcount == 26)
		  begin
		  rdata = FIFO[207:200];
		  d_count = d_count +1;
		  end
		else if( popcount == 27)
		  begin
		  rdata = FIFO[215:208];
		  d_count = d_count +1;
		  end
		else if( popcount == 28)
		  begin
		  rdata = FIFO[223:216];
		  d_count = d_count +1;
		  end
		else if( popcount == 29)
		  begin
		  rdata = FIFO[231:224];
		  d_count = d_count +1;
		  end
		else if( popcount == 30)
		  begin
		  rdata = FIFO[239:232];
		  d_count = d_count +1;
		  end
		else if( popcount == 31)
		  begin
		  rdata = FIFO[247:240];
		  d_count = d_count +1;
		  end
		else if( popcount == 32)
		  begin
		  rdata = FIFO[255:248];
		  d_count = d_count +1;
		  end
		else if( popcount == 33)
		  begin
		  rdata = FIFO[263:256];
		  d_count = d_count +1;
		  end
		else if( popcount == 34)
		  begin
		  rdata = FIFO[271:264];
		  d_count = d_count +1;
		  end
		else if( popcount == 35)
		  begin
		  rdata = FIFO[279:272];
		  d_count = d_count +1;
		  end
		else if( popcount == 36)
		  begin
		  rdata = FIFO[287:280];
		  d_count = d_count +1;
		  end
		else if( popcount == 37)
		  begin
		  rdata = FIFO[295:288];
		  d_count = d_count +1;
		  end
		else if( popcount == 38)
		  begin
		  rdata = FIFO[303:296];
		  d_count = d_count +1;
		  end
		else if( popcount == 39)
		  begin
		  rdata = FIFO[311:304];
		  d_count = d_count +1;
		  end
		else if( popcount == 40)
		  begin
		  rdata = FIFO[319:312];
		  d_count = d_count +1;
		  end
		else if( popcount == 41)
		  begin
		  rdata = FIFO[327:320];
		  d_count = d_count +1;
		  end
		else if( popcount == 42)
		  begin
		  rdata = FIFO[335:328];
		  d_count = d_count +1;
		  end
		else if( popcount == 43)
		  begin
		  rdata = FIFO[343:336];
		  d_count = d_count +1;
		  end
		else if( popcount == 44)
		  begin
		  rdata = FIFO[351:344];
		  d_count = d_count +1;
		  end
		else if( popcount == 45)
		  begin
		  rdata = FIFO[359:352];
		  d_count = d_count +1;
		  end
		else if( popcount == 46)
		  begin
		  rdata = FIFO[367:360];
		  d_count = d_count +1;
		  end
		else if( popcount == 47)
		  begin
		  rdata = FIFO[375:368];
		  d_count = d_count +1;
		  end
		else if( popcount == 48)
		  begin
		  rdata = FIFO[383:376];
		  d_count = d_count +1;
		  end
		else if( popcount == 49)
		  begin
		  rdata = FIFO[391:384];
		  d_count = d_count +1;
		  end
		else if( popcount == 50)
		  begin
		  rdata = FIFO[399:392];
		  d_count = d_count +1;
		  end
		else if( popcount == 51)
		  begin
		  rdata = FIFO[407:400];
		  d_count = d_count +1;
		  end
		else if( popcount == 52)
		  begin
		  rdata = FIFO[415:408];
		  d_count = d_count +1;
		  end
		else if( popcount == 53)
		  begin
		  rdata = FIFO[423:416];
		  d_count = d_count +1;
		  end
		else if( popcount == 54)
		  begin
		  rdata = FIFO[431:424];
		  d_count = d_count +1;
		  end
		else if( popcount == 55)
		  begin
		  rdata = FIFO[439:432];
		  d_count = d_count +1;
		  end
		else if( popcount == 56)
		  begin
		  rdata = FIFO[447:440];
		  d_count = d_count +1;
		  end
		else if( popcount == 57)
		  begin
		  rdata = FIFO[455:448];
		  d_count = d_count +1;
		  end
		else if( popcount == 58)
		  begin
		  rdata = FIFO[463:456];
		  d_count = d_count +1;
		  end
		else if( popcount == 59)
		  begin
		  rdata = FIFO[471:464];
		  d_count = d_count +1;
		  end
		else if( popcount == 60)
		  begin
		  rdata = FIFO[479:472];
		  d_count = d_count +1;
		  end
		else if( popcount == 61)
		  begin
		  rdata = FIFO[487:480];
		  d_count = d_count +1;
		  end
		else if( popcount == 62)
		  begin
		  rdata = FIFO[495:488];
		  d_count = d_count +1;
		  end
		else if( popcount == 63)
		  begin
		  rdata = FIFO[503:496];
		  d_count = d_count +1;
		  end
		else if( popcount == 64)
		  begin
		  rdata = FIFO[511:504];
		  d_count = d_count +1;
		  end
		else if( popcount == 65)
		  begin
		  rdata = FIFO[519:512];
		  d_count = d_count +1;
		  end
		else if( popcount == 66)
		  begin
		  rdata = FIFO[527:520];
		  d_count = d_count +1;
		  end
		else if( popcount == 67)
		  begin
		  rdata = FIFO[535:528];
		  d_count = d_count +1;
		  end
		else if( popcount == 68)
		  begin
		  rdata = FIFO[543:536];
		  d_count = d_count +1;
		  end
		else if( popcount == 69)
		  begin
		  rdata = FIFO[551:544];
		  d_count = d_count +1;
		  end
		else if( popcount == 70)
		  begin
		  rdata = FIFO[559:552];
		  d_count = d_count +1;
		  end
		else if( popcount == 71)
		  begin
		  rdata = FIFO[567:560];
		  d_count = d_count +1;
		  end
		else if( popcount == 72)
		  begin
		  rdata = FIFO[575:568];
		  d_count = d_count +1;
		  end
		else if( popcount == 73)
		  begin
		  rdata = FIFO[583:576];
		  d_count = d_count +1;
		  end
		else if( popcount == 74)
		  begin
		  rdata = FIFO[591:584];
		  d_count = d_count +1;
		  end
		else if( popcount == 75)
		  begin
		  rdata = FIFO[599:592];
		  d_count = d_count +1;
		  end
		else if( popcount == 76)
		  begin
		  rdata = FIFO[607:600];
		  d_count = d_count +1;
		  end
		else if( popcount == 77)
		  begin
		  rdata = FIFO[615:608];
		  d_count = d_count +1;
		  end
		else if( popcount == 78)
		  begin
		  rdata = FIFO[623:616];
		  d_count = d_count +1;
		  end
		else if( popcount == 79)
		  begin
		  rdata = FIFO[631:624];
		  d_count = d_count +1;
		  end
		else if( popcount == 80)
		  begin
		  rdata = FIFO[639:632];
		  d_count = d_count +1;
		  end
		else if( popcount == 81)
		  begin
		  rdata = FIFO[647:640];
		  d_count = d_count +1;
		  end
		else if( popcount == 82)
		  begin
		  rdata = FIFO[655:648];
		  d_count = d_count +1;
		  end
		else if( popcount == 83)
		  begin
		  rdata = FIFO[663:656];
		  d_count = d_count +1;
		  end
		else if( popcount == 84)
		  begin
		  rdata = FIFO[671:664];
		  d_count = d_count +1;
		  end
		else if( popcount == 85)
		  begin
		  rdata = FIFO[679:672];
		  d_count = d_count +1;
		  end
		else if( popcount == 86)
		  begin
		  rdata = FIFO[687:680];
		  d_count = d_count +1;
		  end
		else if( popcount == 87)
		  begin
		  rdata = FIFO[695:688];
		  d_count = d_count +1;
		  end
		else if( popcount == 88)
		  begin
		  rdata = FIFO[703:696];
		  d_count = d_count +1;
		  end
		else if( popcount == 89)
		  begin
		  rdata = FIFO[711:704];
		  d_count = d_count +1;
		  end
		else if( popcount == 90)
		  begin
		  rdata = FIFO[719:712];
		  d_count = d_count +1;
		  end
		else if( popcount == 91)
		  begin
		  rdata = FIFO[727:720];
		  d_count = d_count +1;
		  end
		else if( popcount == 92)
		  begin
		  rdata = FIFO[735:728];
		  d_count = d_count +1;
		  end
		else if( popcount == 93)
		  begin
		  rdata = FIFO[743:736];
		  d_count = d_count +1;
		  end
		else if( popcount == 94)
		  begin
		  rdata = FIFO[751:744];
		  d_count = d_count +1;
		  end
		else if( popcount == 95)
		  begin
		  rdata = FIFO[759:752];
		  d_count = d_count +1;
		  end
		else if( popcount == 96)
		  begin
		  rdata = FIFO[767:760];
		  d_count = d_count +1;
		  end
		else if( popcount == 97)
		  begin
		  rdata = FIFO[775:768];
		  d_count = d_count +1;
		  end
		else if( popcount == 98)
		  begin
		  rdata = FIFO[783:776];
		  d_count = d_count +1;
		  end
		else if( popcount == 99)
		  begin
		  rdata = FIFO[791:784];
		  d_count = d_count +1;
		  end
		else if( popcount == 100)
		  begin
		  rdata = FIFO[799:792];
		  d_count = d_count +1;
		  end
		else if( popcount == 101)
		  begin
		  rdata = FIFO[807:800];
		  d_count = d_count +1;
		  end
		else if( popcount == 102)
		  begin
		  rdata = FIFO[815:808];
		  d_count = d_count +1;
		  end
		else if( popcount == 103)
		  begin
		  rdata = FIFO[823:816];
		  d_count = d_count +1;
		  end
		else if( popcount == 104)
		  begin
		  rdata = FIFO[831:824];
		  d_count = d_count +1;
		  end
		else if( popcount == 105)
		  begin
		  rdata = FIFO[839:832];
		  d_count = d_count +1;
		  end
		else if( popcount == 106)
		  begin
		  rdata = FIFO[847:840];
		  d_count = d_count +1;
		  end
		else if( popcount == 107)
		  begin
		  rdata = FIFO[855:848];
		  d_count = d_count +1;
		  end
		else if( popcount == 108)
		  begin
		  rdata = FIFO[863:856];
		  d_count = d_count +1;
		  end
		else if( popcount == 109)
		  begin
		  rdata = FIFO[871:864];
		  d_count = d_count +1;
		  end
		else if( popcount == 110)
		  begin
		  rdata = FIFO[879:872];
		  d_count = d_count +1;
		  end
		else if( popcount == 111)
		  begin
		  rdata = FIFO[887:880];
		  d_count = d_count +1;
		  end
		else if( popcount == 112)
		  begin
		  rdata = FIFO[895:888];
		  d_count = d_count +1;
		  end
		else if( popcount == 113)
		  begin
		  rdata = FIFO[903:896];
		  d_count = d_count +1;
		  end
		else if( popcount == 114)
		  begin
		  rdata = FIFO[911:904];
		  d_count = d_count +1;
		  end
		else if( popcount == 115)
		  begin
		  rdata = FIFO[919:912];
		  d_count = d_count +1;
		  end
		else if( popcount == 116)
		  begin
		  rdata = FIFO[927:920];
		  d_count = d_count +1;
		  end
		else if( popcount == 117)
		  begin
		  rdata = FIFO[935:928];
		  d_count = d_count +1;
		  end
		else if( popcount == 118)
		  begin
		  rdata = FIFO[943:936];
		  d_count = d_count +1;
		  end
		else if( popcount == 119)
		  begin
		  rdata = FIFO[951:944];
		  d_count = d_count +1;
		  end
		else if( popcount == 120)
		  begin
		  rdata = FIFO[959:952];
		  d_count = d_count +1;
		  end
		else if( popcount == 121)
		  begin
		  rdata = FIFO[967:960];
		  d_count = d_count +1;
		  end
		else if( popcount == 122)
		  begin
		  rdata = FIFO[975:968];
		  d_count = d_count +1;
		  end
		else if( popcount == 123)
		  begin
		  rdata = FIFO[983:976];
		  d_count = d_count +1;
		  end
		else if( popcount == 124)
		  begin
		  rdata = FIFO[991:984];
		  d_count = d_count +1;
		  end
		else if( popcount == 125)
		  begin
		  rdata = FIFO[999:992];
		  d_count = d_count +1;
		  end
		else if( popcount == 126)
		  begin
		  rdata = FIFO[1007:1000];
		  d_count = d_count +1;
		  end
		else if( popcount == 127)
		  begin
		  rdata = FIFO[1015:1008];
		  d_count = d_count +1;
		  end
		else if( popcount == 128)
		  begin
		  rdata = FIFO[1023:1016];
		  d_count = d_count +1;
		  end
		else if( popcount == 129)
		  begin
		  rdata = FIFO[1031:1024];
		  d_count = d_count +1;
		  end
		else if( popcount == 130)
		  begin
		  rdata = FIFO[1039:1032];
		  d_count = d_count +1;
		  end
		else if( popcount == 131)
		  begin
		  rdata = FIFO[1047:1040];
		  d_count = d_count +1;
		  end
		else if( popcount == 132)
		  begin
		  rdata = FIFO[1055:1048];
		  d_count = d_count +1;
		  end
		else if( popcount == 133)
		  begin
		  rdata = FIFO[1063:1056];
		  d_count = d_count +1;
		  end
		else if( popcount == 134)
		  begin
		  rdata = FIFO[1071:1064];
		  d_count = d_count +1;
		  end
		else if( popcount == 135)
		  begin
		  rdata = FIFO[1079:1072];
		  d_count = d_count +1;
		  end
		else if( popcount == 136)
		  begin
		  rdata = FIFO[1087:1080];
		  d_count = d_count +1;
		  end
		else if( popcount == 137)
		  begin
		  rdata = FIFO[1095:1088];
		  d_count = d_count +1;
		  end
		else if( popcount == 138)
		  begin
		  rdata = FIFO[1103:1096];
		  d_count = d_count +1;
		  end
		else if( popcount == 139)
		  begin
		  rdata = FIFO[1111:1104];
		  d_count = d_count +1;
		  end
		else if( popcount == 140)
		  begin
		  rdata = FIFO[1119:1112];
		  d_count = d_count +1;
		  end
		else if( popcount == 141)
		  begin
		  rdata = FIFO[1127:1120];
		  d_count = d_count +1;
		  end
		else if( popcount == 142)
		  begin
		  rdata = FIFO[1135:1128];
		  d_count = d_count +1;
		  end
		else if( popcount == 143)
		  begin
		  rdata = FIFO[1143:1136];
		  d_count = d_count +1;
		  end
		else if( popcount == 144)
		  begin
		  rdata = FIFO[1151:1144];
		  d_count = d_count +1;
		  end
		else if( popcount == 145)
		  begin
		  rdata = FIFO[1159:1152];
		  d_count = d_count +1;
		  end
		else if( popcount == 146)
		  begin
		  rdata = FIFO[1167:1160];
		  d_count = d_count +1;
		  end
		else if( popcount == 147)
		  begin
		  rdata = FIFO[1175:1168];
		  d_count = d_count +1;
		  end
		else if( popcount == 148)
		  begin
		  rdata = FIFO[1183:1176];
		  d_count = d_count +1;
		  end
		else if( popcount == 149)
		  begin
		  rdata = FIFO[1191:1184];
		  d_count = d_count +1;
		  end
		else if( popcount == 150)
		  begin
		  rdata = FIFO[1199:1192];
		  d_count = d_count +1;
		  end
		else if( popcount == 151)
		  begin
		  rdata = FIFO[1207:1200];
		  d_count = d_count +1;
		  end
		else if( popcount == 152)
		  begin
		  rdata = FIFO[1215:1208];
		  d_count = d_count +1;
		  end
		else if( popcount == 153)
		  begin
		  rdata = FIFO[1223:1216];
		  d_count = d_count +1;
		  end
		else if( popcount == 154)
		  begin
		  rdata = FIFO[1231:1224];
		  d_count = d_count +1;
		  end
		else if( popcount == 155)
		  begin
		  rdata = FIFO[1239:1232];
		  d_count = d_count +1;
		  end
		else if( popcount == 156)
		  begin
		  rdata = FIFO[1247:1240];
		  d_count = d_count +1;
		  end
		else if( popcount == 157)
		  begin
		  rdata = FIFO[1255:1248];
		  d_count = d_count +1;
		  end
		else if( popcount == 158)
		  begin
		  rdata = FIFO[1263:1256];
		  d_count = d_count +1;
		  end
		else if( popcount == 159)
		  begin
		  rdata = FIFO[1271:1264];
		  d_count = d_count +1;
		  end
		else if( popcount == 160)
		  begin
		  rdata = FIFO[1279:1272];
		  d_count = d_count +1;
		  end
		else if( popcount == 161)
		  begin
		  rdata = FIFO[1287:1280];
		  d_count = d_count +1;
		  end
		else if( popcount == 162)
		  begin
		  rdata = FIFO[1295:1288];
		  d_count = d_count +1;
		  end
		else if( popcount == 163)
		  begin
		  rdata = FIFO[1303:1296];
		  d_count = d_count +1;
		  end
		else if( popcount == 164)
		  begin
		  rdata = FIFO[1311:1304];
		  d_count = d_count +1;
		  end
		else if( popcount == 165)
		  begin
		  rdata = FIFO[1319:1312];
		  d_count = d_count +1;
		  end
		else if( popcount == 166)
		  begin
		  rdata = FIFO[1327:1320];
		  d_count = d_count +1;
		  end
		else if( popcount == 167)
		  begin
		  rdata = FIFO[1335:1328];
		  d_count = d_count +1;
		  end
		else if( popcount == 168)
		  begin
		  rdata = FIFO[1343:1336];
		  d_count = d_count +1;
		  end
		else if( popcount == 169)
		  begin
		  rdata = FIFO[1351:1344];
		  d_count = d_count +1;
		  end
		else if( popcount == 170)
		  begin
		  rdata = FIFO[1359:1352];
		  d_count = d_count +1;
		  end
		else if( popcount == 171)
		  begin
		  rdata = FIFO[1367:1360];
		  d_count = d_count +1;
		  end
		else if( popcount == 172)
		  begin
		  rdata = FIFO[1375:1368];
		  d_count = d_count +1;
		  end
		else if( popcount == 173)
		  begin
		  rdata = FIFO[1383:1376];
		  d_count = d_count +1;
		  end
		else if( popcount == 174)
		  begin
		  rdata = FIFO[1391:1384];
		  d_count = d_count +1;
		  end
		else if( popcount == 175)
		  begin
		  rdata = FIFO[1399:1392];
		  d_count = d_count +1;
		  end
		else if( popcount == 176)
		  begin
		  rdata = FIFO[1407:1400];
		  d_count = d_count +1;
		  end
		else if( popcount == 177)
		  begin
		  rdata = FIFO[1415:1408];
		  d_count = d_count +1;
		  end
		else if( popcount == 178)
		  begin
		  rdata = FIFO[1423:1416];
		  d_count = d_count +1;
		  end
		else if( popcount == 179)
		  begin
		  rdata = FIFO[1431:1424];
		  d_count = d_count +1;
		  end
		else if( popcount == 180)
		  begin
		  rdata = FIFO[1439:1432];
		  d_count = d_count +1;
		  end
		else if( popcount == 181)
		  begin
		  rdata = FIFO[1447:1440];
		  d_count = d_count +1;
		  end
		else if( popcount == 182)
		  begin
		  rdata = FIFO[1455:1448];
		  d_count = d_count +1;
		  end
		else if( popcount == 183)
		  begin
		  rdata = FIFO[1463:1456];
		  d_count = d_count +1;
		  end
		else if( popcount == 184)
		  begin
		  rdata = FIFO[1471:1464];
		  d_count = d_count +1;
		  end
		else if( popcount == 185)
		  begin
		  rdata = FIFO[1479:1472];
		  d_count = d_count +1;
		  end
		else if( popcount == 186)
		  begin
		  rdata = FIFO[1487:1480];
		  d_count = d_count +1;
		  end
		else if( popcount == 187)
		  begin
		  rdata = FIFO[1495:1488];
		  d_count = d_count +1;
		  end
		else if( popcount == 188)
		  begin
		  rdata = FIFO[1503:1496];
		  d_count = d_count +1;
		  end
		else if( popcount == 189)
		  begin
		  rdata = FIFO[1511:1504];
		  d_count = d_count +1;
		  end
		else if( popcount == 190)
		  begin
		  rdata = FIFO[1519:1512];
		  d_count = d_count +1;
		  end
		else if( popcount == 191)
		  begin
		  rdata = FIFO[1527:1520];
		  d_count = d_count +1;
		  end
		else if( popcount == 192)
		  begin
		  rdata = FIFO[1535:1528];
		  d_count = d_count +1;
		  end
		else if( popcount == 193)
		  begin
		  rdata = FIFO[1543:1536];
		  d_count = d_count +1;
		  end
		else if( popcount == 194)
		  begin
		  rdata = FIFO[1551:1544];
		  d_count = d_count +1;
		  end
		else if( popcount == 195)
		  begin
		  rdata = FIFO[1559:1552];
		  d_count = d_count +1;
		  end
		else if( popcount == 196)
		  begin
		  rdata = FIFO[1567:1560];
		  d_count = d_count +1;
		  end
		else if( popcount == 197)
		  begin
		  rdata = FIFO[1575:1568];
		  d_count = d_count +1;
		  end
		else if( popcount == 198)
		  begin
		  rdata = FIFO[1583:1576];
		  d_count = d_count +1;
		  end
		else if( popcount == 199)
		  begin
		  rdata = FIFO[1591:1584];
		  d_count = d_count +1;
		  end
		else if( popcount == 200)
		  begin
		  rdata = FIFO[1599:1592];
		  d_count = d_count +1;
		  end
		else if( popcount == 201)
		  begin
		  rdata = FIFO[1607:1600];
		  d_count = d_count +1;
		  end
		else if( popcount == 202)
		  begin
		  rdata = FIFO[1615:1608];
		  d_count = d_count +1;
		  end
		else if( popcount == 203)
		  begin
		  rdata = FIFO[1623:1616];
		  d_count = d_count +1;
		  end
		else if( popcount == 204)
		  begin
		  rdata = FIFO[1631:1624];
		  d_count = d_count +1;
		  end
		else if( popcount == 205)
		  begin
		  rdata = FIFO[1639:1632];
		  d_count = d_count +1;
		  end
		else if( popcount == 206)
		  begin
		  rdata = FIFO[1647:1640];
		  d_count = d_count +1;
		  end
		else if( popcount == 207)
		  begin
		  rdata = FIFO[1655:1648];
		  d_count = d_count +1;
		  end
		else if( popcount == 208)
		  begin
		  rdata = FIFO[1663:1656];
		  d_count = d_count +1;
		  end
		else if( popcount == 209)
		  begin
		  rdata = FIFO[1671:1664];
		  d_count = d_count +1;
		  end
		else if( popcount == 210)
		  begin
		  rdata = FIFO[1679:1672];
		  d_count = d_count +1;
		  end
		else if( popcount == 211)
		  begin
		  rdata = FIFO[1687:1680];
		  d_count = d_count +1;
		  end
		else if( popcount == 212)
		  begin
		  rdata = FIFO[1695:1688];
		  d_count = d_count +1;
		  end
		else if( popcount == 213)
		  begin
		  rdata = FIFO[1703:1696];
		  d_count = d_count +1;
		  end
		else if( popcount == 214)
		  begin
		  rdata = FIFO[1711:1704];
		  d_count = d_count +1;
		  end
		else if( popcount == 215)
		  begin
		  rdata = FIFO[1719:1712];
		  d_count = d_count +1;
		  end
		else if( popcount == 216)
		  begin
		  rdata = FIFO[1727:1720];
		  d_count = d_count +1;
		  end
		else if( popcount == 217)
		  begin
		  rdata = FIFO[1735:1728];
		  d_count = d_count +1;
		  end
		else if( popcount == 218)
		  begin
		  rdata = FIFO[1743:1736];
		  d_count = d_count +1;
		  end
		else if( popcount == 219)
		  begin
		  rdata = FIFO[1751:1744];
		  d_count = d_count +1;
		  end
		else if( popcount == 220)
		  begin
		  rdata = FIFO[1759:1752];
		  d_count = d_count +1;
		  end
		else if( popcount == 221)
		  begin
		  rdata = FIFO[1767:1760];
		  d_count = d_count +1;
		  end
		else if( popcount == 222)
		  begin
		  rdata = FIFO[1775:1768];
		  d_count = d_count +1;
		  end
		else if( popcount == 223)
		  begin
		  rdata = FIFO[1783:1776];
		  d_count = d_count +1;
		  end
		else if( popcount == 224)
		  begin
		  rdata = FIFO[1791:1784];
		  d_count = d_count +1;
		  end
		else if( popcount == 225)
		  begin
		  rdata = FIFO[1799:1792];
		  d_count = d_count +1;
		  end
		else if( popcount == 226)
		  begin
		  rdata = FIFO[1807:1800];
		  d_count = d_count +1;
		  end
		else if( popcount == 227)
		  begin
		  rdata = FIFO[1815:1808];
		  d_count = d_count +1;
		  end
		else if( popcount == 228)
		  begin
		  rdata = FIFO[1823:1816];
		  d_count = d_count +1;
		  end
		else if( popcount == 229)
		  begin
		  rdata = FIFO[1831:1824];
		  d_count = d_count +1;
		  end
		else if( popcount == 230)
		  begin
		  rdata = FIFO[1839:1832];
		  d_count = d_count +1;
		  end
		else if( popcount == 231)
		  begin
		  rdata = FIFO[1847:1840];
		  d_count = d_count +1;
		  end
		else if( popcount == 232)
		  begin
		  rdata = FIFO[1855:1848];
		  d_count = d_count +1;
		  end
		else if( popcount == 233)
		  begin
		  rdata = FIFO[1863:1856];
		  d_count = d_count +1;
		  end
		else if( popcount == 234)
		  begin
		  rdata = FIFO[1871:1864];
		  d_count = d_count +1;
		  end
		else if( popcount == 235)
		  begin
		  rdata = FIFO[1879:1872];
		  d_count = d_count +1;
		  end
		else if( popcount == 236)
		  begin
		  rdata = FIFO[1887:1880];
		  d_count = d_count +1;
		  end
		else if( popcount == 237)
		  begin
		  rdata = FIFO[1895:1888];
		  d_count = d_count +1;
		  end
		else if( popcount == 238)
		  begin
		  rdata = FIFO[1903:1896];
		  d_count = d_count +1;
		  end
		else if( popcount == 239)
		  begin
		  rdata = FIFO[1911:1904];
		  d_count = d_count +1;
		  end
		else if( popcount == 240)
		  begin
		  rdata = FIFO[1919:1912];
		  d_count = d_count +1;
		  end
		else if( popcount == 241)
		  begin
		  rdata = FIFO[1927:1920];
		  d_count = d_count +1;
		  end
		else if( popcount == 242)
		  begin
		  rdata = FIFO[1935:1928];
		  d_count = d_count +1;
		  end
		else if( popcount == 243)
		  begin
		  rdata = FIFO[1943:1936];
		  d_count = d_count +1;
		  end
		else if( popcount == 244)
		  begin
		  rdata = FIFO[1951:1944];
		  d_count = d_count +1;
		  end
		else if( popcount == 245)
		  begin
		  rdata = FIFO[1959:1952];
		  d_count = d_count +1;
		  end
		else if( popcount == 246)
		  begin
		  rdata = FIFO[1967:1960];
		  d_count = d_count +1;
		  end
		  else if( popcount == 247)
			  begin
			  rdata = FIFO[1975:1968];
			  d_count = d_count +1;
			  end
			else if( popcount == 248)
			  begin
			  rdata = FIFO[1983:1976];
			  d_count = d_count +1;
			  end
			else if( popcount == 249)
			  begin
			  rdata = FIFO[1991:1984];
			  d_count = d_count +1;
			  end
			else if( popcount == 250)
			  begin
			  rdata = FIFO[1999:1992];
			  d_count = d_count +1;
			  end
			else if( popcount == 251)
			  begin
			  rdata = FIFO[2007:2000];
			  d_count = d_count +1;
			  end
			else if( popcount == 252)
			  begin
			  rdata = FIFO[2015:2008];
			  d_count = d_count +1;
			  end
			else if( popcount == 253)
			  begin
			  rdata = FIFO[2023:2016];
			  d_count = d_count +1;
			  end
			else if( popcount == 254)
			  begin
			  rdata = FIFO[2031:2024];
			  d_count = d_count +1;
			  end
			else if( popcount == 255)
			  begin
			  rdata = FIFO[2039:2032];
			  d_count = d_count +1;
			  end
			else if( popcount == 256)
			  begin
			  rdata = FIFO[2047:2040];
			  d_count = d_count +1;
			  end

			//$display ("rdata is = %b", rdata);
			end
			end
	endmodule
